﻿namespace X2OPC.Core.DA
{
    using System;
    using System.Runtime.InteropServices;

    [ComImport, Guid("39c13a72-011e-11d0-9675-0020afd8adb3"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), ComVisible(true)]
    public interface IOPCItemProperties
    {
        /// <summary>
        /// 查询可用的 OPCItem属性
        /// </summary>
        /// <param name="szItemID"></param>
        /// <param name="dwCount"></param>
        /// <param name="ppPropertyIDs"></param>
        /// <param name="ppDescriptions"></param>
        /// <param name="ppvtDataTypes"></param>
        /// <returns></returns>
        [PreserveSig]
        int QueryAvailableProperties([In, MarshalAs(UnmanagedType.LPWStr)] string szItemID, out int dwCount, out IntPtr ppPropertyIDs, out IntPtr ppDescriptions, out IntPtr ppvtDataTypes);

        /// <summary>
        /// 取得 OPCItem 的属性 
        /// </summary>
        /// <param name="szItemID"></param>
        /// <param name="dwCount"></param>
        /// <param name="pdwPropertyIDs"></param>
        /// <param name="ppvData"></param>
        /// <param name="ppErrors"></param>
        /// <returns></returns>
        [PreserveSig]
        int GetItemProperties([In, MarshalAs(UnmanagedType.LPWStr)] string szItemID, [In] int dwCount, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] int[] pdwPropertyIDs, out IntPtr ppvData, out IntPtr ppErrors);

        /// <summary>
        /// 使用名称查询OPCItem 的 ID 
        /// </summary>
        /// <param name="szItemID"></param>
        /// <param name="dwCount"></param>
        /// <param name="pdwPropertyIDs"></param>
        /// <param name="ppszNewItemIDs"></param>
        /// <param name="ppErrors"></param>
        /// <returns></returns>
        [PreserveSig]
        int LookupItemIDs([In, MarshalAs(UnmanagedType.LPWStr)] string szItemID, [In] int dwCount, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] int[] pdwPropertyIDs, out IntPtr ppszNewItemIDs, out IntPtr ppErrors);
    }
}
